package com.bupt.ilink.mapper;

import com.bupt.ilink.entity.DatasetTags;
import com.bupt.ilink.entity.ModelTags;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author LENOVO
* @description 针对表【model_tags】的数据库操作Mapper
* @createDate 2024-08-03 16:28:24
* @Entity generator.domain.ModelTags
*/
@Mapper
public interface ModelTagsMapper extends BaseMapper<ModelTags> {

    @Select("SELECT * FROM model_tags WHERE model_id = #{modelId}")
    List<ModelTags> selectByModelId(Long modelId);

    @Select("SELECT tag FROM model_tags " +
            "WHERE tag IS NOT NULL AND tag <> '' " +
            "GROUP BY tag " +
            "ORDER BY COUNT(*) DESC " +
            "LIMIT 8")
    List<String> selectCommonTags();
}




